<template>
	<view class="content">
		<scroll-view scroll-y="true" >
			<view class="row">
				<view class="col-22 pdl-1 pdr-1 list" v-for="(item,index) in orderlist" :key="index" @click="select(item)">
					<view class="row title">
						<view class="col-12">
							{{item.createTime}}
						</view>
						<view class="col-12 t_right">
							{{item.orderType == 1 ? item.orderTypeText : item.orderStateInsideText}}
						</view>
					</view>
					<view class="row content">
						<view class="col-3">
							<view class="row con_left">
								<view class="col-24 t_center scd">
									<image src="../../static/trip/scd@2x.png" mode="heightFix"></image>
								</view>
								<view class="col-24 t_center x2x">
									<image src="../../static/trip/x@2x.png" mode="heightFix"></image>
								</view>
								<view class="col-24 t_center xcd">
									<image src="../../static/trip/xcd@2x.png" mode="heightFix"></image>
								</view>
							</view>
						</view>
						<view class="col-21">
							<view class="row con_right">
								<view class="col-24">
									{{item.getOnPoint}}
								</view>
								<view class="col-24">
									{{item.getOffPoint}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				objPage: {
					pageNum: 1,
					pageSize: 10
				},
				loading: true,
				orderlist: []
			}
		},
		onLoad() {
			this.load();
		},
		onReachBottom() {
			this.objPage.pageNum += 1;
			this.load();
		},
		methods:{
			async load(){
				if( !this.loading){
					return
				}
				let res = await this.$api.request(this.$api.customer.orderlist,this.objPage);
				if(res){
					this.orderlist = this.orderlist.concat(res.list);
					if(this.objPage.pageSize != res.size){
						this.loading = false;
					}
				}
			},
			select(item){
				uni.setStorage({
					data:item,
					key : 'orderDetail',
					success() {
						uni.navigateBack()
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F5F5F5;
	}
	scroll-view{
		margin-top: 21rpx;
		max-height: calc(100vh - 96rpx);
	}
	.list{
		margin-bottom: 21rpx;
		background-color: #FFFFFF;
		.title{
			height: 89rpx;
			line-height: 89rpx;
			color: #999999;
			border-bottom: 1px solid #f5f5f5;
			.t_right{
				color: #FF2626;
			}
			.t_color{
				color: #B3B3B3;
			}
		}
		.content{
			height: 101rpx;
			padding: 30rpx 0;
			border-bottom: 1px solid #f5f5f5;
			.con_left{
				height: 101rpx;
				.scd,
				.xcd{
					height: 20rpx;
					image{
						height: 14rpx;
					}
				}
				.xcd{
					position: relative;
					bottom: 23rpx;
				}
				.x2x{
					position: relative;
					height: 60rpx;
					image{
						height: 100%;
					}
				}
			}
			.con_right{
				height: 101rpx;
				line-height: 50rpx;
			}
		}
		.tab_cancel{
			height: 90rpx;
			button[type="primary"]{
				padding: 0;
				height: 60rpx;
				line-height: 60rpx;
				margin-top: 15rpx;
				border-radius: 30rpx;
				background-color: #6CBF30;
			}
		}
	}
</style>
